import("//llvm/lib/Target/targets.gni")

group("unittests") {
  deps = [
    "ADT:ADTTests",
    "Analysis:AnalysisTests",
    "AsmParser:AsmParserTests",
    "BinaryFormat:BinaryFormatTests",
    "Bitcode:BitcodeTests",
    "Bitstream:BitstreamTests",
    "CodeGen:CodeGenTests",
    "CodeGen/GlobalISel:GlobalISelTests",
    "DebugInfo/CodeView:DebugInfoCodeViewTests",
    "DebugInfo/DWARF:DebugInfoDWARFTests",
    "DebugInfo/GSYM:DebugInfoGSYMTests",
    "DebugInfo/MSF:DebugInfoMSFTests",
    "DebugInfo/PDB:DebugInfoPDBTests",
    "Demangle:DemangleTests",
    "ExecutionEngine:ExecutionEngineTests",
    "ExecutionEngine/JITLink:JITLinkTests",
    "ExecutionEngine/MCJIT:MCJITTests",
    "ExecutionEngine/Orc:OrcJITTests",
    "FileCheck:FileCheckTests",
    "Frontend:LLVMFrontendTests",
    "FuzzMutate:FuzzMutateTests",
    "IR:IRTests",
    "InterfaceStub:InterfaceStubTests",
    "LineEditor:LineEditorTests",
    "Linker:LinkerTests",
    "MC:MCTests",
    "MI:MITests",
    "MIR:MIRTests",
    "Object:ObjectTests",
    "ObjectYAML:ObjectYAMLTests",
    "Option:OptionTests",
    "Passes:PassesBindingsTests",
    "Passes:PluginsTests",
    "ProfileData:ProfileDataTests",
    "Remarks:RemarksTests",
    "Support:SupportTests",
    "Support/DynamicLibrary:DynamicLibraryTests",
    "TableGen:TableGenTests",
    "TextAPI:TextAPITests",
    "Transforms/IPO:IPOTests",
    "Transforms/Scalar:ScalarTests",
    "Transforms/Utils:UtilsTests",
    "Transforms/Vectorize:VectorizeTests",
    "XRay:XRayTests",
    "tools/llvm-cfi-verify:CFIVerifyTests",
    "tools/llvm-exegesis:LLVMExegesisTests",
    "tools/llvm-profgen:LLVMProfgenTests",
  ]

  # Target-dependent unit tests.
  # FIXME: This matches how they are set up in the cmake build,
  # but if we disable an arch after building with it on, this
  # setup leaves behind stale executables.
  if (llvm_build_AArch64) {
    deps += [
      "Target/AArch64:AArch64Tests",
      "tools/llvm-exegesis/AArch64:LLVMExegesisAArch64Tests",
    ]
  }
  if (llvm_build_AMDGPU) {
    deps += [
      "MC/AMDGPU:AMDGPUDwarfTests",
      "Target/AMDGPU:AMDGPUTests",
    ]
  }
  if (llvm_build_ARM) {
    deps += [
      "Target/ARM:ARMTests",
      "tools/llvm-exegesis/ARM:LLVMExegesisARMTests",
    ]
  }
  if (llvm_build_Mips) {
    deps += [ "tools/llvm-exegesis/Mips:LLVMExegesisMipsTests" ]
  }
  if (llvm_build_PowerPC) {
    deps += [
      "Target/PowerPC:PowerPCTests",
      "tools/llvm-exegesis/PowerPC:LLVMExegesisPowerPCTests",
    ]
  }
  if (llvm_build_SystemZ) {
    deps += [ "MC/SystemZ:SystemZAsmLexerTests" ]
  }
  if (llvm_build_WebAssembly) {
    deps += [ "Target/WebAssembly:WebAssemblyTests" ]
  }
  if (llvm_build_X86) {
    deps += [
      "Target/X86:X86Tests",
      "tools/llvm-exegesis/X86:LLVMExegesisX86Tests",
    ]
  }

  testonly = true
}
